package org.scboy.gateway.loads;

import org.apache.dubbo.config.annotation.DubboReference;
import org.scboy.rbac.api.IRbacManager;
import org.scboy.utils.entitys.rbac.LoginUser;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableCaching
public class LoadRbacManager {

	@DubboReference
	IRbacManager manager;
	
	/**
	 * 获取登录用户信息
	 * @param token
	 * @return
	 */
	@Cacheable(value="RBAC_LOGIN_CACHE",key="#token",unless="#result == null")
	public LoginUser getLogin(String token) {
		return manager.checkLogin(token);
	}
	
	public boolean checkAuth(String userId,String path) {
		return manager.checkAuth(userId, path);
	}
	
	
}
